﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CarolLib.Control;
using DispatchAssist.Model;

namespace DispatchAssist.AppHost
{
    public partial class ucPromptAlert : UserControl
    {

        NormalAlertInfo alertinfo;

        public ucPromptAlert()
        {
            InitializeComponent();
        }

        public ucPromptAlert(NormalAlertInfo nainfo)
        {
            InitializeComponent();
            alertinfo = nainfo;
        }

        public ucPromptAlert(NormalAlertInfo nainfo, int i)
            : this(nainfo)
        {
            this.grpEarlyWarningInfo.Text = string.Format("[{0}]", i);
            BindBaseInfoOfAlertMessage();
        }

        private void BindBaseInfoOfAlertMessage()
        {
            txtFlightNo.Text = ((alertinfo.Carrier == null) ? "" : alertinfo.Carrier) + ((alertinfo.FlightNo == null) ? "" : alertinfo.FlightNo);
            txtTailNo.Text = (alertinfo.TailNo == null) ? "" : alertinfo.TailNo;
            txtAirPort.Text = (alertinfo.AirportFullName == null) ? "" : alertinfo.AirportFullName;
            txtAlertLevel.Text = (alertinfo.WarnLevelName == null) ? "" : alertinfo.WarnLevelName;
            txtAlertTime.Text = alertinfo.WarnTime.ToString();
            rtbMessageContent.BackColor = this.BackColor;
            //rtbMessageContent.Font = grpEarlyWarningInfo.Font;
            rtbMessageContent.Text = (alertinfo.MessageBody == null) ? "" : alertinfo.MessageBody;

        }

        private void ucPromptAlert_Load(object sender, EventArgs e)
        {

        }
    }
}
